/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.ua.miect.sd.simuladorpesca.config;

import java.io.Serializable;



/**
 * ServiceConfig contains the configuration for a node. Including the service that is been provided and the IP and Port
 * @author PedroA
 */
public class ServiceConfig implements Serializable {
    private NodeService service;
    private String ipAddress;
    private int port;

    /**
     * Default constructor
     */
    public ServiceConfig()
    {
        service = NodeService.NotDefined;
        ipAddress = null;
        port = 0;
    }

    /**
     * Gets the Current Service
     * @return the service
     */
    public NodeService getService() {
        return service;
    }

    /**
     * @param service the service to set
     */
    public void setService(NodeService service) {
        this.service = service;
    }

    /**
     * @return the ipAddress
     */
    public String getIpAddress() {
        return ipAddress;
    }

    /**
     * @param ipAddress the ipAddress to set
     */
    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }

    /**
     * @return the port
     */
    public int getPort() {
        return port;
    }

    /**
     * @param port the port to set
     */
    public void setPort(int port) {
        this.port = port;
    }

    /**
     * toString Override
     * @return valid ip address or "New Service"
     */
    @Override
    public String toString() {
        if (ipAddress != null){
            return ipAddress.toString() + ":" + port + "="+service;
        }
        else
        {
            return "New Service";
        }
    }



}
